package com.cpkso.sprdata.service;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.cpkso.sprdata.domain.Author;
import com.cpkso.sprdata.domain.Book;
import com.cpkso.sprdata.repository.BookRepository;

/**
 * @author wrzhxy@qq.com
 * @date 2017年11月8日
 */
@Service
@Transactional
public class BookService {
	private final BookRepository bookRepository;
	
	public BookService(BookRepository bookRepository) {
		this.bookRepository = bookRepository;
	}
	
	public List<Book> dosomething(Author author) {
		return bookRepository.findByAuthor(author);
	}
	
	public Book publish(Book book) {
		return bookRepository.save(book);
	}
	
}
